//
//  HttpRequest.h
//  TaskManager
//
//  Created by Sun on 2019/3/11.
//  Copyright © 2019 Sun. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/**
 请求成功，接口调用成功回调

 @param operation 响应体
 @param responseObject 响应数据
 @param code 是否调用成功
 @param errorCode 错误码
 */
typedef void(^RequestSuccess)(NSURLSessionDataTask *operation, id responseObject ,BOOL code ,NSInteger errorCode);
typedef void(^RequestFail)(NSError *error);
typedef void(^RequestProgress)(NSProgress *progress);

@interface HttpRequest : NSObject

@property (nonatomic, strong) NSMutableArray * managerArray;

+ (HttpRequest *)shareManager;

+ (AFHTTPSessionManager *)GetWithApi:(NSString *)url params:(id)dic progress:(RequestProgress)progress success:(RequestSuccess)success fail:(RequestFail)fail;

+ (AFHTTPSessionManager *)noDismissHudPostWithApi:(NSString *)url params:(id)dic progress:(RequestProgress)progress success:(RequestSuccess)success fail:(RequestFail)fail;

+ (AFHTTPSessionManager *)PostWithApi:(NSString *)url params:(id)dic progress:(RequestProgress)progress success:(RequestSuccess)success fail:(RequestFail)fail;

+ (AFURLSessionManager *)PostJsonWithApi:(NSString *)url params:(id)dic progress:(RequestProgress)progress success:(RequestSuccess)success fail:(RequestFail)fail;

+ (void)PostUploadImgWithApi:(NSString *)url params:(NSString *)dicStr success:(RequestSuccess)success dail:(RequestFail)fail;

+ (AFHTTPSessionManager *)postImgDataWithUrl:(NSString *)url imgData:(NSData *)imgData imgFile:(NSString *)imgFile withParameter:(NSDictionary *)dic sucess:(RequestSuccess)sucessCallBack failure:(RequestFail)failureCallBack;

+ (AFHTTPSessionManager *)postImgWithUrl:(NSString *)url
      imglist:(NSArray *)imglist
      imgFile:(NSString *)imgFile
withParameter:(NSDictionary *)dic
       sucess:(RequestSuccess)sucessCallBack
                                 failure:(RequestFail)failureCallBack;

+ (NSInteger)getNetworkStatus;

@end

NS_ASSUME_NONNULL_END
